package com.lancoo.ccas53.controller;


import com.lancoo.ccas53.aspect.LogAnnotation;
import com.lancoo.ccas53.pojo.vo.CourseVo;
import com.lancoo.ccas53.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Optional;

@Api(tags = "导入导出")
@RestController
@RequestMapping("/excel")
public class ExcelController {


    @Resource
    private RuleWeekDayService ruleWeekDayService;
    @Resource
    private RoomService roomService;
    @Resource
    private CollegeService collegeService;
    @Resource
    private MajorGradeService majorGradeService;
    @Resource
    private TeacherService teacherService;
    @Resource
    private ScheduleService scheduleService;
    @Resource
    private SubClassService subClassService;
    @Resource
    private CourseService courseService;
    @Resource
    private CssSelectCourseService selectCourseService;


    @Resource
    private StudentService studentService;
    @ApiOperation("自学课程教学班导入")
    @PostMapping(value = "/importSelfCourseTeachingClass")
    public void importSelfCourseTeachingClass(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                              @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                              @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                              @ApiParam(value = "唯一标识", required = true) @RequestParam String uuid,
                                              @ApiParam("file") @RequestPart("file") MultipartFile file) {
        selectCourseService.importSelfCourseTeachingClass(response, taskId, flag, uuid, file);
    }

    @ApiOperation("导出教学活动安排")
    @GetMapping(value = "/exportTeachingActivitySchedule")
    public void exportTeachingActivitySchedule(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                               @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                               @ApiParam(value = "基础平台学院id", required = false) @RequestParam(required = false) String baseCollegeId,
                                               @ApiParam(value = "对应年级id", required = false) @RequestParam(required = false) String gradeId,
                                               @ApiParam(value = "基础平台专业id", required = false) @RequestParam(required = false) String baseMajorId,
                                               @ApiParam(value = "专业模糊查询", required = false) @RequestParam(required = false) String keyword,
                                               @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                               @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize) {
        ruleWeekDayService.exportTeachingActivitySchedule(response, taskId, baseCollegeId, gradeId, baseMajorId, keyword, currentPage, pageSize);
    }


    @ApiOperation("导入教学活动安排")
    @PostMapping(value = "/importTeachingActivitySchedule")
    public void importTeachingActivitySchedule(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                               @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                               @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                               @ApiParam("file") @RequestPart("file") MultipartFile file) {
        ruleWeekDayService.importTeachingActivitySchedule(response, taskId, flag, file);
    }


    @ApiOperation("导出节假日安排")
    @GetMapping(value = "/exportHolidaySchedule")
    public void exportHolidaySchedule(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                      @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        ruleWeekDayService.exportHolidaySchedule(response, taskId);
    }


    @ApiOperation("导入节假日安排")
    @PostMapping(value = "/importHolidaySchedule")
    public void importHolidaySchedule(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                      @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                      @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                      @ApiParam("file") @RequestPart("file") MultipartFile file) {
        ruleWeekDayService.importHolidaySchedule(response, taskId, flag, file);
    }


    @ApiOperation("导入场地信息")
    @PostMapping(value = "/importVenueInformationSettings")
    public void importVenueInformationSettings(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                               @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                               @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                               @ApiParam("file") @RequestPart("file") MultipartFile file) {
        roomService.importVenueInformationSettings(response, taskId, flag, file);
    }


    @ApiOperation("场地信息设置导出")
    @GetMapping(value = "/exportVenueInformationSettings")
    public void exportVenueInformationSettings(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                               @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                               @ApiParam(value = "所属校区id", required = false) @RequestParam(required = false) Integer campusId,
                                               @ApiParam(value = "对应场地类型id", required = false) @RequestParam(required = false) Integer roomType,
                                               @ApiParam(value = "是否可用 0未启用 1启用", required = false) @RequestParam(required = false) Integer isEnable,
                                               @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                               @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize) {
        roomService.exportHolidaySchedule(response, taskId, campusId, roomType, isEnable, currentPage, pageSize);
    }


    @ApiOperation("场地分配导出")
    @GetMapping(value = "/exportSiteAllocationDerivation")
    public void exportSiteAllocationDerivation(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                               @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                               @ApiParam(value = "学院id", required = false) @RequestParam(required = false) String baseCollegeId,
                                               @ApiParam(value = "场地分配状态  0、未分配 1、已分配", required = false) @RequestParam(required = false) Integer roomSet) {
        collegeService.exportSiteAllocationDerivation(response, taskId, baseCollegeId, roomSet);
    }


    @ApiOperation("场地分配导入")
    @PostMapping(value = "/importSiteAllocation")
    public void importSiteAllocation(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                     @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                     @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                     @ApiParam("file") @RequestPart("file") MultipartFile file) {
        roomService.importSiteAllocation(response, taskId, flag, file);
    }


    @ApiOperation("教学任务导入")
    @PostMapping(value = "/importConfirmTeachingTask")
    public void importConfirmTeachingTask(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                          @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                          @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                          @ApiParam("file") @RequestPart("file") MultipartFile file) {
        subClassService.importConfirmTeachingTask(response, taskId, flag, file);
    }


    @ApiOperation("分组导入")
    @PostMapping(value = "/importGroupClass")
    public void importGroupClass(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                 @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                 @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                 @ApiParam("file") @RequestPart("file") MultipartFile file) {
        subClassService.importGroupClass(response, taskId, flag, file);
    }


    @ApiOperation("学生信息设置导出")
    @GetMapping(value = "/exportStudentInformationSettings")
    public void exportStudentInformationSettings(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                                 @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                 @ApiParam(value = "所属校区id", required = false) @RequestParam(required = false) Integer campusId,
                                                 @ApiParam(value = "基础平台学院id", required = false) @RequestParam(required = false) String baseCollegeId,
                                                 @ApiParam(value = "基础平台专业id", required = false) @RequestParam(required = false) String baseMajorId,
                                                 @ApiParam(value = "对应年级id", required = false) @RequestParam(required = false) String gradeId,
                                                 @ApiParam(value = "专业名模糊查询", required = false) @RequestParam(required = false) String keyword,
                                                 @ApiParam(value = "是否允许跨校区排课 null 全部 0未开启 1已开启", required = false) @RequestParam(required = false) Integer isCampusCross,
                                                 @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                                 @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize) {
        majorGradeService.exportStudentInformationSettings(response, taskId, campusId, baseCollegeId, baseMajorId, gradeId, keyword, isCampusCross, currentPage, pageSize);
    }

    @ApiOperation("学生信息导入")
    @PostMapping(value = "/importStudentInformationSettings")
    public void importStudentInformationSettings(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                 @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                                 @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                                 @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importStudentInformationSettings(response, taskId, flag, file);
    }


    @ApiOperation("教师信息设置导出")
    @GetMapping(value = "/exportTeacherInformationSettings")
    public void exportTeacherInformationSettings(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                                 @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                 @ApiParam(value = "所属校区id", required = false) @RequestParam(required = false) Integer campusId,
                                                 @ApiParam(value = "基础平台学院id", required = false) @RequestParam(required = false) String baseCollegeId,
                                                 @ApiParam(value = "1、任课教师 2、助教教师", required = false) @RequestParam(required = false) Integer identity,
                                                 @ApiParam(value = "是否允许跨校区排课 0未开启 1已开启", required = false) @RequestParam(required = false) Integer isCampusCross,
                                                 @ApiParam(value = "教师名模糊查询", required = false) @RequestParam(required = false) String keyword,
                                                 @ApiParam(value = "课程id", required = false) @RequestParam(required = false) Long courseId,
                                                 @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                                 @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize) {
        majorGradeService.exportTeacherInformationSettings(response, taskId, campusId, baseCollegeId, identity, isCampusCross, keyword, courseId, currentPage, pageSize);
    }


    @ApiOperation("教师信息导入")
    @PostMapping(value = "/importTeacherInformationSettings")
    public void importTeacherInformationSettings(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                 @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                                 @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                                 @ApiParam("file") @RequestPart("file") MultipartFile file) {
        teacherService.importTeacherInformationSettings(response, taskId, flag, file);
    }


    @ApiOperation("确认开课计划导出")
    @PostMapping(value = "/exportOfTheStartPlan")
    public void exportOfTheStartPlan(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                     @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                     @ApiParam(value = "院系名称", required = true) @RequestParam String collegeName,
                                     @ApiParam(value = "年级名称", required = true) @RequestParam String gradeName,
                                     @ApiParam(value = "专业名称", required = true) @RequestParam String majorName,
                                     @ApiParam(value = "课程类别名称", required = true) @RequestParam String courseTypeName,
                                     @ApiParam(value = "任务流程id", required = true) @RequestParam String courseNatureName,
                                     @ApiParam(value = "任务流程id", required = true) @RequestParam String stateName,
                                     @ApiParam(value = "开课计划", required = true) @RequestBody CourseVo param) {
        majorGradeService.exportOfTheStartPlan(response, taskId, collegeName, gradeName, majorName, courseTypeName, courseNatureName, stateName, param);
    }


    @ApiOperation("开课计划导入")
    @PostMapping(value = "/importOfTheStartPlan")
    public void importOfTheStartPlan(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                     @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                     @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                     @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importOfTheStartPlan(response, taskId, flag, file);
    }


    @ApiOperation("设置预选课轮次导出")
    @GetMapping(value = "/exportSetThePreSelectedCourseRotation")
    public void exportSetThePreSelectedCourseRotation(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                                      @ApiParam(value = "1预选 2正式选课", required = false) @RequestParam(required = false) Optional<Integer> type,
                                                      @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportSetThePreSelectedCourseRotation(response, taskId, type);
    }


    @ApiOperation("确认预选课结果导出")
    @GetMapping(value = "/exportThePreselectionResult")
    public void exportThePreselectionResult(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                            @ApiParam(value = "导出需要", required = false) @RequestParam(required = false) String courseName,
                                            @ApiParam(value = "导出需要", required = false) @RequestParam(required = false) String collegeName,
                                            @ApiParam(value = "导出需要", required = false) @RequestParam(required = false) String courseTypeName,
                                            @ApiParam(value = "导出需要", required = false) @RequestParam(required = false) String courseNatureName,
                                            @ApiParam(value = "导出需要", required = false) @RequestParam(required = false) String selectStudentNums,
                                            @ApiParam(value = "导出需要", required = false) @RequestParam(required = false) String state,
                                            @ApiParam(value = "导出需要", required = false) @RequestParam(required = false) String isCourseState,
                                            @ApiParam(value = "学院id", required = false) @RequestParam(required = false) String baseCollegeId,
                                            @ApiParam(value = "课程类别id", required = false) @RequestParam(required = false) String courseTypeId,
                                            @ApiParam(value = "课程性质 1必修 2选修", required = false) @RequestParam(required = false) Optional<Integer> courseNature,
                                            @ApiParam(value = "课程名模糊查询", required = false) @RequestParam(required = false) String keyword,
                                            @ApiParam(value = "开课状态 0取消开班 1正常开班", required = false) @RequestParam(required = false) Optional<Integer> isEnable,
                                            @ApiParam(value = "是否达到开班要求 0 否 1、是", required = false) @RequestParam(required = false) Optional<Integer> isAchieveOpen,
                                            @ApiParam(value = "页容", required = false) @RequestParam(required = false) Integer pageSize,
                                            @ApiParam(value = "页码", required = false) @RequestParam(required = false) Integer currentPage,
                                            @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportThePreselectionResult(response, taskId, courseName, collegeName, courseTypeName, courseNatureName, selectStudentNums, state, isCourseState, baseCollegeId, courseTypeId, courseNature, keyword, isEnable, isAchieveOpen, pageSize, currentPage);
    }


    @ApiOperation("预选课日志导出")
    @GetMapping(value = "/exportPreSelectedCourseLogs")
    public void exportPreSelectedCourseLogs(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                            @ApiParam(value = "轮次id", required = false) @RequestParam(required = false) Long roundId,
                                            @ApiParam(value = "基础平台学院id", required = false) @RequestParam(required = false) String baseCollegeId,
                                            @ApiParam(value = "对应年级id", required = false) @RequestParam(required = false) String gradeId,
                                            @ApiParam(value = "班级id", required = false) @RequestParam(required = false) String classId,
                                            @ApiParam(value = "课程id", required = false) @RequestParam(required = false) Long courseId,
                                            @ApiParam(value = "开始时间", required = false) @RequestParam(required = false) String startDateTime,
                                            @ApiParam(value = "结束时间", required = false) @RequestParam(required = false) String endDateTime,
                                            @ApiParam(value = "学号姓名模糊查询", required = false) @RequestParam(required = false) String keyword,
                                            @ApiParam(value = "页容", required = false) @RequestParam(required = false) Integer pageSize,
                                            @ApiParam(value = "页码", required = false) @RequestParam(required = false) Integer currentPage,
                                            @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportPreSelectedCourseLogs(response, taskId, roundId, baseCollegeId, gradeId, classId, courseId, startDateTime, endDateTime, keyword, pageSize, currentPage);
    }



    @ApiOperation("生成教学班导出")
    @GetMapping(value = "/exportTeachingClassCourse")
    public void exportTeachingClassCourse(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                                @ApiParam(value = "课程id", required = false) @RequestParam(required = false) Long courseId,
                                                @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportTeachingClassCourse(response, taskId,courseId);
    }

    @ApiOperation("场地禁排导出")
    @GetMapping(value = "/exportProhibitedFromDischarging")
    public void exportProhibitedFromDischarging(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                                @ApiParam(value = "校区id", required = false) @RequestParam(required = false) Integer campusId,
                                                @ApiParam(value = "楼宇id", required = false) @RequestParam(required = false) Integer buildingId,
                                                @ApiParam(value = "楼层", required = false) @RequestParam(required = false) Integer floor,
                                                @ApiParam(value = "教室类型", required = false) @RequestParam(required = false) Integer roomType,
                                                @ApiParam(value = "关键字", required = false) @RequestParam(required = false) String keyword,
                                                @ApiParam(value = "数据范围 0：全部，1：已设置，2未设置") @RequestParam Integer dataRange,
                                                @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                                @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize,
                                                @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportProhibitedFromDischarging(response, taskId, campusId, buildingId, floor, roomType, keyword, dataRange, currentPage, pageSize);
    }






    @ApiOperation("课程规则导出")
    @GetMapping(value = "/exportCourseRule")
    public void exportCourseRule(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                 @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                 @ApiParam(value = "0全部 1已设置 2未设置") @RequestParam(required = false) Integer dataRange,
                                 @ApiParam(value = "基础平台学院id") @RequestParam(required = false) String baseCollegeId,
                                 @ApiParam(value = "课程类别id") @RequestParam(required = false) String courseTypeId,
                                 @ApiParam(value = "课程性质 1必修 2选修") @RequestParam(required = false) Integer courseNature,
                                 @ApiParam(value = "1、课程 2、环节") @RequestParam(required = false) Integer flag,
                                 @ApiParam(value = "课程名模糊查") @RequestParam(required = false) String keyword,
                                 @ApiParam(value = "参数是否设置  0、未设置  1、已设置") @RequestParam(required = false) Integer parameterSet,
                                 @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                 @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize) {
        majorGradeService.exportCourseRule(response, taskId, dataRange, baseCollegeId, courseTypeId, courseNature, flag, keyword, parameterSet, currentPage, pageSize);
    }


    @ApiOperation("课程规则导入")
    @PostMapping(value = "/importCourseRule")
    public void importCourseRule(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                 @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                 @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                 @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importCourseRule(response, taskId, flag, file);
    }


    @ApiOperation("场地禁排导入")
    @PostMapping(value = "/importSiteExclusion")
    public void importSiteExclusion(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                    @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                    @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                    @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importSiteExclusion(response, taskId, flag, file);
    }


    @ApiOperation("教师禁排优先排导出")
    @GetMapping(value = "/exportAssignedPriorityOfTeachers")
    public void exportAssignedPriorityOfTeachers(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                                 @ApiParam(value = "开课单位", required = false) @RequestParam(required = false) String baseCollageId,
                                                 @ApiParam(value = "关键字", required = false) @RequestParam(required = false) String keyword,
                                                 @ApiParam(value = "数据范围 0：全部，1：已设置，2未设置") @RequestParam Integer dataRange,
                                                 @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                                 @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize,
                                                 @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportAssignedPriorityOfTeachers(response, taskId, baseCollageId, keyword, dataRange, currentPage, pageSize);
    }


    @ApiOperation("教师禁排优先排导入")
    @PostMapping(value = "/importAssignedPriorityOfTeachers")
    public void importAssignedPriorityOfTeachers(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                 @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                                 @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                                 @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importAssignedPriorityOfTeachers(response, taskId, flag, file);
    }


    @ApiOperation("课程禁排优先排导出")
    @GetMapping(value = "/exportForbiddenOfCourse")
    public void exportForbiddenOfCourse(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                        @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                        @ApiParam(value = "开课单位", required = false) @RequestParam(required = false) String baseCollageId,
                                        @ApiParam(value = "课程类别", required = false) @RequestParam(required = false) String courseTypeId,
                                        @ApiParam(value = "课程性质", required = false) @RequestParam(required = false) Integer courseNature,
                                        @ApiParam(value = "关键字", required = false) @RequestParam(required = false) String keyword,
                                        @ApiParam(value = "数据范围 0：全部，1：已设置，2未设置") @RequestParam Integer dataRange,
                                        @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                        @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize) {
        majorGradeService.exportForbiddenOfCourse(response, taskId, baseCollageId, keyword, courseTypeId, courseNature, dataRange, currentPage, pageSize);
    }


    @ApiOperation("课程禁排优先排导入")
    @PostMapping(value = "/importForbiddenOfCourse")
    public void importForbiddenOfCourse(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                        @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                        @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                        @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importForbiddenOfCourse(response, taskId, flag, file);
    }


    @ApiOperation("导出教师课表")
    @GetMapping(value = "/excel/teacher")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void teacherScheduleToExcel(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                       @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                       @ApiParam(value = "老师id", required = true) @RequestParam Long teacherId,
                                       @ApiParam(value = "单位", required = false) @RequestParam(required = false) String baseCollegeName) {
        scheduleService.teacherScheduleToExcel(response, taskId, teacherId, baseCollegeName);
    }


    @ApiOperation("批量导出教师课表")
    @GetMapping(value = "/excel/teacherBatch")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void teacherBatch(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                             @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                             @ApiParam(value = "年级", required = false) @RequestParam(required = false) String collegeId) {
        scheduleService.teacherBatch(response, taskId, collegeId);
    }


    @ApiOperation("导出场地课表")
    @GetMapping(value = "/excel/exportedVenueSchedule")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void exportedVenueSchedule(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                      @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                      @ApiParam(value = "教室id", required = true) @RequestParam Long roomId) {
        scheduleService.exportedVenueSchedule(response, taskId, roomId);
    }


    @ApiOperation("批量导出场地课表")
    @GetMapping(value = "/excel/exportRoomBatch")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void exportRoomBatch(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                @ApiParam(value = "教室id", required = true) @RequestParam String buildingId) {
        scheduleService.exportRoomBatch(response, taskId, buildingId);
    }


    @ApiOperation("导出学生课表")
    @GetMapping(value = "/excel/exportStudentSchedule")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void exportStudentSchedule(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                      @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                      @ApiParam(value = "学生id", required = true) @RequestParam Long student) {
        scheduleService.exportStudentSchedule(response, taskId, student);
    }


    @ApiOperation("导出行政班课表")
    @GetMapping(value = "/excel/exportClassScheduleV2")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void exportClassScheduleV2(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                      @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                      @ApiParam(value = "学生id", required = true) @RequestParam Long student) {
        scheduleService.exportClassScheduleV2(response, taskId, student);
    }


    @ApiOperation("导出行政班课表")
    @GetMapping(value = "/excel/exportClassSchedule")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void exportClassSchedule(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                    @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                    @ApiParam(value = "学生id", required = true) @RequestParam String classId) {
        scheduleService.exportClassSchedule(response, taskId, classId);
    }


    @ApiOperation("批量导出行政班课表")
    @GetMapping(value = "/excel/exportClassScheduleBatch")
    @LogAnnotation(operationType = "14", operationContent = "导出教师课表")
    public void exportClassScheduleBatch(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                         @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                         @ApiParam(value = "教室id", required = true) @RequestParam String gradeId) {
        scheduleService.exportClassScheduleBatch(response, taskId, gradeId);
    }


    @ApiOperation("导出班级、教室、教师、教学班总表")
    @GetMapping(value = "/excel/classTotal")
    @LogAnnotation(operationType = "14", operationContent = "导出班级、教室、教师、教学班总表")
    public void summaryScheduleToExcel(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                       @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                       @ApiParam(value = "1:教室 2:教师 3:行政班 4:教学班", required = true) @RequestParam(required = true) Integer scheduleType) throws IOException {
        scheduleService.summaryScheduleToExcel(response, taskId, scheduleType);
    }


    @ApiOperation("导出环节全校课表")
    @GetMapping(value = "/excel/segment")
    @LogAnnotation(operationType = "14", operationContent = "导出环节全校课表")
    public void schoolSegmentScheduleToExcel(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                             @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                             @ApiParam(value = "环节类别id 传null全部", required = false) @RequestParam(required = false) String collegeId,
                                             @ApiParam(value = "年级", required = false) @RequestParam(required = false) String gradeId,
                                             @ApiParam(value = "搜索关键字", required = false) @RequestParam(required = false) String keyword) {
        scheduleService.segmentToExcel(response, taskId, gradeId, collegeId, keyword);
    }


    @ApiOperation("设置选课轮次导出")
    @GetMapping(value = "/exportSetCourseSelection")
    public void exportSetCourseSelection(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                         @ApiParam(value = "1预选 2正式选课", required = false) @RequestParam(required = false) Optional<Integer> type,
                                         @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportSetCourseSelection(response, taskId, type);
    }


    @ApiOperation("按教学班导出")
    @GetMapping(value = "/exportOfClass")
    public void exportOfClass(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                              @ApiParam(value = "院系名称", required = false) @RequestParam(required = false) String collegeName,
                              @ApiParam(value = "专业名称", required = false) @RequestParam(required = false) String majorName,
                              @ApiParam(value = "年级名称", required = false) @RequestParam(required = false) String gradeName,
                              @ApiParam(value = "校区名称", required = false) @RequestParam(required = false) String campusName,
                              @ApiParam(value = "教师名称", required = false) @RequestParam(required = false) String teacherName,
                              @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                              @ApiParam(value = "1、课程 2、环节") @RequestParam(required = false) Integer courseOrLink,
                              @ApiParam(value = "校区") @RequestParam(required = false) Integer campusId,
                              @ApiParam(value = "行政班学院") @RequestParam(required = false) String baseCollegeId,
                              @ApiParam(value = "年级") @RequestParam(required = false) String gradeId,
                              @ApiParam(value = "专业id") @RequestParam(required = false) String baseMajorId,
                              @ApiParam(value = "教学班名模糊查") @RequestParam(required = false) String keyword,
                              @ApiParam(value = "教师id") @RequestParam(required = false) Long teacherId) {
        majorGradeService.exportOfClass(response, collegeName, majorName, gradeName, campusName, teacherName, taskId, courseOrLink, campusId, baseCollegeId, gradeId, baseMajorId, keyword, teacherId);
    }


    @ApiOperation("上课分组")
    @GetMapping(value = "/exportOfTeachingGroup")
    public void exportOfTeachingGroup(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                      @ApiParam(value = "院系名称", required = false) @RequestParam(required = false) String collegeName,
                                      @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                      @ApiParam(value = "分组名模糊查") @RequestParam(required = false) String keyword,
                                      @ApiParam(value = "行政班学院") @RequestParam(required = false) String baseCollegeId) {
        majorGradeService.exportOfTeachingGroup(response, collegeName, taskId, baseCollegeId, keyword);
    }


    @ApiOperation("拆班导出")
    @GetMapping(value = "/exportSubClass")
    public void exportSubClass(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                               @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                               @ApiParam(value = "拆班名模糊查") @RequestParam(required = false) String keyword,
                               @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                               @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize) {
        majorGradeService.exportSubClass(response, taskId, keyword, currentPage, pageSize);
    }


    @ApiOperation("拆班导入")
    @PostMapping(value = "/importSubClass")
    public void importSubClass(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                               @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                               @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                               @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importSubClass(response, taskId, flag, file);
    }

    @ApiOperation("按学生导出")
    @GetMapping(value = "/exportOfStudent")
    public void exportOfStudent(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                @ApiParam(value = "课程", required = false) @RequestParam(required = false) String courseName,
                                @ApiParam(value = "开课单位", required = false) @RequestParam(required = false) String collegeName,
                                @ApiParam(value = "课程类别", required = false) @RequestParam(required = false) String courseType,
                                @ApiParam(value = "课程性质", required = false) @RequestParam(required = false) String courseNatureName,
                                @ApiParam(value = "已选学生人数", required = false) @RequestParam(required = false) String selectStudentNums,
                                @ApiParam(value = "说明", required = false) @RequestParam(required = false) String state,
                                @ApiParam(value = "开课状态", required = false) @RequestParam(required = false) String isCourseState,
                                @ApiParam(value = "开课状态", required = false) @RequestParam(required = false) String baseCollegeId,
                                @ApiParam(value = "课程类别id", required = false) @RequestParam(required = false) String courseTypeId,
                                @ApiParam(value = "课程性质 1必修 2选修", required = false) @RequestParam(required = false) Optional<Integer> courseNature,
                                @ApiParam(value = "课程名模糊查询", required = false) @RequestParam(required = false) String keyword,
                                @ApiParam(value = "开课状态 0取消开班 1正常开班", required = false) @RequestParam(required = false) Optional<Integer> isEnable,
                                @ApiParam(value = "是否达到开班要求 0 否 1、是", required = false) @RequestParam(required = false) Optional<Integer> isAchieveOpen,
                                @ApiParam(value = "页容", required = false) @RequestParam(required = false) Integer pageSize,
                                @ApiParam(value = "页码", required = false) @RequestParam(required = false) Integer currentPage,
                                @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportOfStudent(response, taskId, courseName, collegeName, courseName, courseType, courseNatureName, selectStudentNums, state, isCourseState, baseCollegeId, courseTypeId, courseNature, keyword, isEnable, isAchieveOpen, pageSize, currentPage);
    }


    @ApiOperation("选课日志导出")
    @GetMapping(value = "/exportSelectLog")
    public void exportSelectLog(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                @ApiParam(value = "轮次id", required = false) @RequestParam(required = false) Long roundId,
                                @ApiParam(value = "基础平台学院id", required = false) @RequestParam(required = false) String baseCollegeId,
                                @ApiParam(value = "对应年级id", required = false) @RequestParam(required = false) String gradeId,
                                @ApiParam(value = "班级id", required = false) @RequestParam(required = false) String classId,
                                @ApiParam(value = "课程id", required = false) @RequestParam(required = false) Integer courseId,
                                @ApiParam(value = "开始时间", required = false) @RequestParam(required = false) String startDateTime,
                                @ApiParam(value = "结束时间", required = false) @RequestParam(required = false) String endDateTime,
                                @ApiParam(value = "学号姓名模糊查询", required = false) @RequestParam(required = false) String keyword,
                                @ApiParam(value = "页容", required = false) @RequestParam(required = false) Integer pageSize,
                                @ApiParam(value = "页码", required = false) @RequestParam(required = false) Integer currentPage,
                                @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportSelectLog(response, taskId, roundId, baseCollegeId, gradeId, classId, courseId, startDateTime, endDateTime, keyword, pageSize, currentPage);
    }


    @ApiOperation("课程信息导出")
    @GetMapping(value = "/exportCourseInformation")
    public void exportCourseInformation(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                        @ApiParam(value = "课程", required = false) @RequestParam(required = false) String courseName,
                                        @ApiParam(value = "开课单位", required = false) @RequestParam(required = false) String collegeName,
                                        @ApiParam(value = "课程类别", required = false) @RequestParam(required = false) String courseType,
                                        @ApiParam(value = "课程性质", required = false) @RequestParam(required = false) String courseNatureName,
                                        @ApiParam(value = "已选学生人数", required = false) @RequestParam(required = false) String selectStudentNums,
                                        @ApiParam(value = "说明", required = false) @RequestParam(required = false) String state,
                                        @ApiParam(value = "开课状态", required = false) @RequestParam(required = false) String isCourseState,
                                        @ApiParam(value = "开课状态", required = false) @RequestParam(required = false) String baseCollegeId,
                                        @ApiParam(value = "课程类别id", required = false) @RequestParam(required = false) String courseTypeId,
                                        @ApiParam(value = "课程性质 1必修 2选修", required = false) @RequestParam(required = false) Optional<Integer> courseNature,
                                        @ApiParam(value = "课程名模糊查询", required = false) @RequestParam(required = false) String keyword,
                                        @ApiParam(value = "开课状态 0取消开班 1正常开班", required = false) @RequestParam(required = false) Optional<Integer> isEnable,
                                        @ApiParam(value = "是否达到开班要求 0 否 1、是", required = false) @RequestParam(required = false) Optional<Integer> isAchieveOpen,
                                        @ApiParam(value = "页容", required = false) @RequestParam(required = false) Integer pageSize,
                                        @ApiParam(value = "页码", required = false) @RequestParam(required = false) Integer currentPage,
                                        @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        courseService.exportCourseInformation(response, taskId, courseName, collegeName, courseName, courseType, courseNatureName, selectStudentNums, state, isCourseState, baseCollegeId, courseTypeId, courseNature, keyword, isEnable, isAchieveOpen, pageSize, currentPage);
    }


    @ApiOperation("课程信息导入")
    @GetMapping(value = "/importCourseInformation")
    public void importCourseInformation(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                        @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                        @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                        @ApiParam("file") @RequestPart("file") MultipartFile file) {
        courseService.importCourseInformation(response, taskId, flag, file);
    }


    @ApiOperation("分级导入")
    @PostMapping(value = "/importTeachingClassDifferentLevels")
    public void importTeachingClassDifferentLevels(@ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                                   @ApiParam(value = "任务流程id", required = true) HttpServletResponse response,
                                                   @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                                   @ApiParam(value = "课程id", required = true) @RequestParam String baseCourseId,
                                                   @ApiParam(value = "院系id", required = true) @RequestParam String baseCollegeId,
                                                   @ApiParam("file") @RequestPart("file") MultipartFile file) {
        majorGradeService.importTeachingClassDifferentLevels(response, taskId, flag, file, baseCollegeId, baseCourseId);
    }


    @ApiOperation("按教学班确认")
    @GetMapping(value = "/exportConfirmByClass")
    public void exportConfirmByClass(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                     @ApiParam(value = "选课轮次名称") @RequestParam(required = false) String cssRoundName,
                                     @ApiParam(value = "院系名称") @RequestParam(required = false) String collegeName,
                                     @ApiParam(value = "课程类别名称") @RequestParam(required = false) String courseTypeName,
                                     @ApiParam(value = "课程性质名称") @RequestParam(required = false) String courseNature,
                                     @ApiParam(value = "课程名称") @RequestParam(required = false) String courseName,
                                     @ApiParam(value = "基础平台学院id") @RequestParam(required = false) String baseCollegeId,
                                     @ApiParam(value = "课程id") @RequestParam(required = false) Long courseId,
                                     @ApiParam(value = "0正选 1重修") @RequestParam(required = false) Integer flag,
                                     @ApiParam(value = "学号姓名模糊查询") @RequestParam(required = false) String keyword,
                                     @ApiParam(value = "轮次id") @RequestParam(required = false) Integer roundId,
                                     @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize,
                                     @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                     @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId) {
        majorGradeService.exportConfirmByClass(response, cssRoundName, collegeName, courseTypeName, courseNature, courseName, baseCollegeId, courseId, flag, keyword, pageSize, currentPage, taskId, roundId);
    }


    @ApiOperation("按学生确认")
    @GetMapping(value = "/exportConfirmByStudent")
    public void exportConfirmByStudent(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                       @ApiParam(value = "轮次名称") @RequestParam(required = false) String cssRoundName,
                                       @ApiParam(value = "院系名称") @RequestParam(required = false) String collegeName,
                                       @ApiParam(value = "课程类别名称") @RequestParam(required = false) String courseTypeName,
                                       @ApiParam(value = "课程性质名称") @RequestParam(required = false) String courseNature,
                                       @ApiParam(value = "课程名称") @RequestParam(required = false) String courseName,
                                       @ApiParam(value = "基础平台学院id") @RequestParam(required = false) String baseCollegeId,
                                       @ApiParam(value = "对应年级id") @RequestParam(required = false) String gradeId,
                                       @ApiParam(value = "班级id") @RequestParam(required = false) String classId,
                                       @ApiParam(value = "学号姓名模糊查询") @RequestParam(required = false) String keyword,
                                       @ApiParam(value = "0正选 1 重修") @RequestParam(required = false) Integer flag,
                                       @ApiParam(value = "页容", required = true) @RequestParam Integer pageSize,
                                       @ApiParam(value = "页码", required = true) @RequestParam Integer currentPage,
                                       @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                       @ApiParam(value = "1：仅看存在未选课程的学生") @RequestParam(required = false) Integer needToSelect,
                                       @ApiParam(value = "轮次id") @RequestParam(required = false) Integer roundId) {
        majorGradeService.exportConfirmByStudent(response, cssRoundName, collegeName, courseTypeName, courseNature, courseName, baseCollegeId, gradeId, classId, keyword, flag, pageSize, currentPage, taskId, needToSelect, roundId);
    }


    @ApiOperation("学生导入")
    @PostMapping(value = "/exportStudent")
    public void exportStudent(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                              @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                              @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                              @ApiParam("file") @RequestPart("file") MultipartFile file) {
        studentService.exportStudent(response, taskId, flag, file);
    }


    @ApiOperation("教学班导入")
    @PostMapping(value = "/importTeachingClass")
    public void importTeachingClass(@ApiParam(value = "返回响应", required = false) HttpServletResponse response,
                                    @ApiParam(value = "任务流程id", required = true) @RequestHeader Integer taskId,
                                    @ApiParam(value = "符号 1 追加导入 2 覆盖", required = true) @RequestParam Integer flag,
                                    @ApiParam("file") @RequestPart("file") MultipartFile file) {
        studentService.importTeachingClass(response, taskId, flag, file);
    }


    @ApiOperation("未设置教学班导出")
    @GetMapping(value = "/exportTeachingClass")
    public void exportTeachingClass(@ApiParam(value = "返回响应", required = false) HttpServletResponse response) {
        studentService.exportTeachingClass(response);
    }


    @ApiOperation("修改教学班roomId")
    @GetMapping(value = "/updateTeachingClassWeek")
    public void updateTeachingClassWeek() {
        studentService.updateTeachingClassWeek();
    }


}
